package com.learn.eduorder.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.learn.eduapi.entity.UserCourseOrder;

import java.util.List;

public interface IOrderService extends IService<UserCourseOrder> {

    int STATUS_NOT_PAY = 0; //未支付
    int STATUS_IS_PAY = 1;  //已支付
    int STATUS_CANCELD = 2; //已取消
    int STATUS_EXPIRED = 3; //已过期

    /**
     * 保存订单
     * @param order
     */
    void saveOrder(UserCourseOrder order);

    /**
     * 修改订单状态
     * @param tradeNo
     * @param status
     */
    UserCourseOrder changeOrderStatus(String tradeNo, long status);

    /**
     * 查询用户订单
     * @param userId
     * @return
     */
    List<UserCourseOrder> findUserOrders(long userId);

    /**
     * 逻辑删除订单
     * @param orderId
     */
    void deleteOrder(long orderId);

    /**
     * 完成支付
     * @param tradeNo
     */
    void finishPay(String tradeNo);
}
